pkg load control
Gs =tf([5],[1 5]);
Cs = pid(1.1);
sys =Cs * Gs;
Ts = feedback(Cs*Gs,1);
Ss=1/(1+Cs *Gs);
t=0:0.01:50;
r=ones(size(t));
disturbance=0.5*sin(0.1*t);
noise=0.2*sin(100*t);

x1=lsim(Ts,r-noise,t);
k2=lsim(ss,disturbance,t);

figure(1,'position',[200 200 1600 300]);
subplot(1,2,1);
title('Disturbance');
plot(t,disturbance);
ylim([-0.6,0.6]);
grid on;
subplot(1,2,2);
title('noise');
plot(t,noise);
ylim([-0.6,0.6]);
grid on;

figure(2,'position',[100 200 600 600]);
bode(Gs,{0.01:100});

figure(3,'position',[100 200 600 600]);
bode(Cs,{0.01:100});

figure(4,'position',[1300 200 600 600]);
bode(Cs*Gs,{0.01:100});

figure(5,'position',[200 200 1200 600]);
plot(t,x1 + x2,"linewidth",1);
hold on;
plot(t,ones(size(t)),"linewidth",1,'Linestyle','--');
ylim([0,1.25]);
grid on;